package com.cynteka.cyfoman.core.config;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

/**
 * User: Sergey
 * Date: 28.07.11
 * Time: 0:20
 */
@XmlRootElement
public class Explorer {
    private String baseFolder;
    private String title;
    private String icon;
    private List<ColumnMD> columns;
    private List<ExplorerRowType> rowTypes;

    public void setColumns(List<ColumnMD> columns) {
        this.columns = columns;
    }

    public void setRowTypes(List<ExplorerRowType> rowTypes) {
        this.rowTypes = rowTypes;
    }

    @XmlElement
    public List<ColumnMD> getColumns() {
        return columns;
    }

    @XmlElement
    public List<ExplorerRowType> getRowTypes() {
        return rowTypes;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Explorer explorer = (Explorer) o;

        if (baseFolder != null ? !baseFolder.equals(explorer.baseFolder) : explorer.baseFolder != null) return false;
        if (columns != null ? !columns.equals(explorer.columns) : explorer.columns != null) return false;
        if (icon != null ? !icon.equals(explorer.icon) : explorer.icon != null) return false;
        if (rowTypes != null ? !rowTypes.equals(explorer.rowTypes) : explorer.rowTypes != null) return false;
        if (title != null ? !title.equals(explorer.title) : explorer.title != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = baseFolder != null ? baseFolder.hashCode() : 0;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (icon != null ? icon.hashCode() : 0);
        result = 31 * result + (columns != null ? columns.hashCode() : 0);
        result = 31 * result + (rowTypes != null ? rowTypes.hashCode() : 0);
        return result;
    }

    public Explorer() {
    }

    public Explorer(String baseFolder) {
        this.baseFolder = baseFolder;
    }

    @XmlElement
    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    @XmlElement
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @XmlElement
    public String getBaseFolder() {
        return baseFolder;
    }

    public void setBaseFolder(String baseFolder) {
        this.baseFolder = baseFolder;
    }

    @Override
    public String toString() {
        return "Explorer{" +
                "baseFolder='" + baseFolder + '\'' +
                ", title='" + title + '\'' +
                ", icon='" + icon + '\'' +
                ", columns=" + columns +
                ", rowTypes=" + rowTypes +
                '}';
    }

}
